package com.itheima.controller;


import com.itheima.service.ITOrderService;
import com.itheima.service.ITSeckillArticleService;
import com.itheima.service.impl.TOrderServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.websocket.server.PathParam;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author astupidcoder
 * @since 2021-05-15
 */
@RestController
@RequestMapping("/t-order")
@CrossOrigin
public class TOrderController {

    @Autowired
    private ITOrderService itOrderService;

    @Autowired
    private TOrderServiceImpl tOrderService;

    @Autowired
    private RedisTemplate redisTemplate;

    @GetMapping("/grabbingOrders")
    public String grabbingOrders(@PathParam("articleId") String articleId) throws Exception {
        tOrderService.POrder1("1",articleId,"1");
        return "OK";
    }

    @GetMapping("/start")
    public String start() {
        tOrderService.initializationStockNum("100");
        return "初始化库存成功";
    }
}
